Design and Validation of a Custom-Made Hyperspectral Microscope Imaging System for Biomedical Applications

Hyperspectral microscope imaging (HMI) is an emerging modality that integrates spatial information collected by standard laboratory microscopy and the spectral-based contrast obtained by hyperspectral imaging and may be instrumental in establishing novel quantitative diagnostic methodologies, particularly in histopathology. Further expansion of HMI capabilities hinges upon the modularity and versatility of systems and their proper standardization. In this report, we describe the design, calibration, characterization, and validation of the custom-made laboratory HMI system based on a Zeiss Axiotron fully motorized microscope and a custom-developed Czerny-Turner-type monochromator. For these important steps, we rely on a previously designed calibration protocol. Validation of the system demonstrates a performance comparable to classic spectrometry laboratory systems. We further demonstrate validation against a laboratory hyperspectral imaging system for macroscopic samples, enabling future comparison of spectral imaging results across length scales. An example of the utility of our custom-made HMI system on a standard hematoxylin and eosin-stained histology slide is also shown.


Introduction
Established histopathology relies on color and shape information collected by standard laboratory microscopy, typically using stained tissue cell specimens. One of the ways to offer new insights into histopathologic diagnosis is to add spectral-based contrast by means of hyperspectral imaging (HSI), which offers the advantages of quantitative absorbance measurements and computation of contrast resulting from light scattering on tissue constituents. Such an integrated approach, often called hyperspectral microscope imaging (HMI) [1], has already been used in the biomedical field to detect various types of carcinoma and other pathological conditions [2][3][4][5][6][7] and may be instrumental in establishing quantitative histopathology as the new diagnostic standard.
Different approaches to HMI have been used in the past, including point-wise scanning [8,9], linear push-broom scanning [6,10], snapshot mapping [5,11,12], filtered techniques based on liquid crystal tunable filters (LCTF) [13], and acousto-optic tunable filters (AOTF) [14,15], either on the emission or excitation side. Although such systems offer a broad spectral range in hundreds of nanometers, their spectral resolution is typically limited to a few 10 nm [16,17]. In the literature, the performance of methods has also been improved by compressive sensing, implemented through digital micromirror device (DMD) encoding [18] or through the use of coded-aperture masks [19,20]. As shown by recent studies [21], rapid development of different HMI modalities and applications has been achieved in the last few years. The different systems, however, follow different characterization protocols, which makes standardization problematic. One of the motivations of the present paper is to present a template of metrics to be evaluated as part of the standardization. Furthermore, due to the relatively large price of hyperspectral microscopy systems, a reduction in price is needed to facilitate the development of the field. The system presented in this paper strives to be applicable to a broad range of different existing microscopes through its modular design, thus decreasing the price of setting up a hyperspectral microscope. The spectral filtering approach enables selectivity in spectral ranges to be imaged, a feature that is usually absent in spatial scanning methods (push-broom and point-wise scanning). This spectral selectivity can, in turn, decrease the acquisition time and can further be used to test more multispectral acquisition schemes without any additional modification.
Hyperspectral microscopy has found applications within the biomedical [21] and other fields, such as nanotechnology [22]. Many biomedical studies focus on color enhancements, digital staining, and fluorescence imaging [21]. One promising option frequently used in the analysis of hyperspectral microscopy images is the use of artificial intelligence for segmentation and classification [23,24]. A logical next step is the quantitative analysis of chromophore concentration, with possible applications in the development of quantitative imaging and laying a foundation for the development of quantitative imaging biomarkers. This development, however, requires the use of calibrated and characterized microscopy systems that can reliably measure both optical and dimension-related properties of the samples.
The primary objective of this study was to validate the custom-made HMI system with the overall goal of piloting standardization of the protocols. While designing a custom-made HMI system is demanding, systematic application of validation protocols offers grounds for future standardization, which may also influence the development of commercial systems. Furthermore, the performance of the developed system was compared and validated against the hyperspectral system for macroscopic sample imaging.
Achieving the objectives thus put forth is especially necessary to ensure the repeatability of measurements using the system and to enable quantitative imaging. To achieve these goals, the presented protocol characterizes the most important parameters of a hyperspectral microscope imaging system as well as verifies it against a reference method. In turn, the imaging system presented in this paper is, to the best of our knowledge, the first that is characterized, verified against a reference method, and compared to a hyperspectral imaging system for macroscopic imaging. Additionally, the comparison of results against the system for macroscopic imaging offers new possibilities for reliably imaging samples across different length scales, thus addressing an open question in biophotonics [25].
In the first section of the paper, we describe the design of the system; in the second section, we discuss its calibration and characterization; and finally, we show the system's validation and an example of its use in biomedicine.

Materials and Methods
This section of the paper describes the development and construction of the HMI system, starting with the system requirements and following through with a detailed description of system components. It concludes with an adaptation of the previously published validation and calibration protocol [26] applicable to the filtered methodology of hyperspectral imaging

HMI System
Before constructing the system, the following requirements for the HMI system were identified to enable the imaging of biological samples and facilitate further quantitative analysis: 1.
The system should offer a spectral range from approximately 400 nm to 800 nm (dictated by chromophores) with a spectral resolution in the range of 1 nm-5 nm (to study fine spectral features of chromophore absorption).

2.
The spatial resolution should be greater than 5 µm to discern changes inside the cell nucleus. 3. The wavelength range should be adjustable to decrease sample acquisition time; automatic acquisition of multiple areas on the sample should be possible to enable imaging of large samples. 4.
The system should be modular, allowing for any pertinent modifications in the future, and should also be adaptable to different microscopes. 5.
Since samples were expected to be thin, the primary modality was transmission imaging.
The selection of the wavelength range between 400 nm and 800 nm is based on four important technological and physical considerations. (A) The majority of commonly studied tissue native chromophores have features in this range (e.g., hemoglobin, beta carotene) [27]. (B) Histopathological slides are stained with stains that are optimized for visible light contrast due to the traditional nature of observation with the naked eye through the microscope. (C) Many commercial systems have optics designed to perform best in the visible part of the spectrum. This choice of the wavelength range thus makes the system applicable to a broader range of microscopes. (D) Quantum efficiency of most nonspecialized silicon-based detectors decreases at wavelengths higher than 800 nm.
In the continuation, we briefly outline the major components of the system with additional technical information outlined in Appendices A and B.

Microscope
The core system is based on a Zeiss Axiotron (Carl Zeiss, Germany) upright inspection microscope equipped with an auto-focus system (Carl Zeiss, Germany) that is used for computerized control of the focusing mechanism (z-axis manipulation). It is further upgraded with a motorized stage and controller for movement in x-y directions (MC2000, Marzhauser-Wetzlar, Wetzlar, Germany). Together, these upgrades enable full computerized control of positioning and refocusing, thus fulfilling the requirement for whole slide imaging. The microscope is fitted with Epiplan-NEOFLUAR HD objective lenses (2.5×, 5×, 10×, 20×, 50×, 100×). These objective lenses are optimized for imaging without cover glass, but according to the manufacturer's specifications, lenses up to 20× can also be used with samples sporting coverslips without unacceptable deterioration in image quality. A specific advantage of the Epiplan-NEOFLUAR HD series is the presence of a darkfield illumination ring, which can be used in future research.

Camera
For image acquisition, a high-quality camera is required with the following specifications: 1.
Due to the low amount of light per spectral band and, thus, longer exposure times, both low dark current and high quantum efficiency of the detector are required.

2.
The light intensity can vary dramatically in the specified spectral range; therefore, a high well depth resulting in a large dynamic contrast is needed.

3.
The resolution of the camera must be good enough to provide detailed images of the samples.
To satisfy these conditions, the microscope is coupled to an Andor Zyla 5.5 USB3.0 camera (Oxford Instruments, Belfast, UK), which has a resolution of 5.5 megapixels (image size 2560 × 2160), 16.6 × 14.0 mm active area, 64% quantum efficiency at 600 nm as well as low readout noise (0.9 e − at 200 MHz readout rate) and exceptionally low dark current (0.1 e − /pixel/s with forced air cooling). The full dynamic range employing 16-bit architecture is 33,000:1. The pixel size is 6.5 µm in both width and height. Due to the large detector size, the camera is coupled to the trinocular head (camera port) of the microscope without any magnification adjustments.

Light Source
The main custom-made part of the system consists of a light source coupled to a specially designed illuminator for transillumination. Since spectral band selectivity is required, the filtered approach to hyperspectral imaging is implemented, in which only a handful of spectral bands can be selected for imaging to obtain relevant spectral features with the benefit of decreasing the acquisition time. Additionally, the spectral width of the illumination can be adjusted, and although this means decreasing the spectral resolution, it increases the signal-to-noise ratio at the same time while further decreasing acquisition time. Monochromatic light for sample illumination is obtained from a halogen lamp using a custom-made single-grating monochromator in the Czerny-Turner configuration [28]. The complete setup is schematically depicted in Figure 1. The monochromator, beam splitter, and condenser assembly with all other components of the HMI system are described in detail in Appendix A, while the system's software development is outlined in Appendix B.
without any magnification adjustments.

Light Source
The main custom-made part of the system consists of a light source coupled to a specially designed illuminator for transillumination. Since spectral band selectivity is required, the filtered approach to hyperspectral imaging is implemented, in which only a handful of spectral bands can be selected for imaging to obtain relevant spectral features with the benefit of decreasing the acquisition time. Additionally, the spectral width of the illumination can be adjusted, and although this means decreasing the spectral resolution, it increases the signal-to-noise ratio at the same time while further decreasing acquisition time. Monochromatic light for sample illumination is obtained from a halogen lamp using a custom-made single-grating monochromator in the Czerny-Turner configuration [28]. The complete setup is schematically depicted in Figure 1. The monochromator, beam splitter, and condenser assembly with all other components of the HMI system are described in detail in Appendix A, while the system's software development is outlined in Appendix B. Figure 1. Outline of the hyperspectral microscope imaging (HMI) system setup. Light from the halogen lamp is collected by a lens and passed into a Czerny-Turner-type monochromator of custom design. Monochromatic light is then directed into the coupler, where part of the light is used for online monitoring via a spectrometer. The remaining part of the light, along with light from an optional high-power white LED used for orientation, is passed through a fiber bundle light guide. Using a custom Köhler illumination assembly, light impinges on the sample. Light from the sample is collected by an objective and passes through the microscope to either eyepieces or a camera used for data acquisition. Legend: Lx-lenses, Mx-mirrors, Ix-apertures, DG-diffraction grating, ELL-rotation stage, BS-beamsplitter, LT-tube lens, DM-dichroic mirror, CAM-camera, AFautofocus system.

Validation and Calibration Protocols
An important goal of this research was to implement a well-defined system design for validated quantitative imaging. Such design would facilitate system replication and, thus, allow its utilization in multicentric studies. The latter presents a key steppingstone in the process of development of quantitative biomarkers, an ultimate goal in any imaging Figure 1. Outline of the hyperspectral microscope imaging (HMI) system setup. Light from the halogen lamp is collected by a lens and passed into a Czerny-Turner-type monochromator of custom design. Monochromatic light is then directed into the coupler, where part of the light is used for online monitoring via a spectrometer. The remaining part of the light, along with light from an optional high-power white LED used for orientation, is passed through a fiber bundle light guide. Using a custom Köhler illumination assembly, light impinges on the sample. Light from the sample is collected by an objective and passes through the microscope to either eyepieces or a camera used for data acquisition. Legend: Lx-lenses, Mx-mirrors, Ix-apertures, DG-diffraction grating, ELL-rotation stage, BS-beamsplitter, LT-tube lens, DM-dichroic mirror, CAM-camera, AF-autofocus system.

Validation and Calibration Protocols
An important goal of this research was to implement a well-defined system design for validated quantitative imaging. Such design would facilitate system replication and, thus, allow its utilization in multicentric studies. The latter presents a key steppingstone in the process of development of quantitative biomarkers, an ultimate goal in any imaging modality development. To achieve these objectives, a protocol for calibration and validation of hyperspectral imaging systems [26] was adapted to suit the specifics of the hyperspectral microscopy setup and, more generally, to be compatible with an imaging protocol using light from a monochromator. A schematic overview of the protocol is shown in Figure 2. modality development. To achieve these objectives, a protocol for ca validation of hyperspectral imaging systems [26] was adapted to suit the s hyperspectral microscopy setup and, more generally, to be compatible wi protocol using light from a monochromator. A schematic overview of t shown in Figure 2. Protocol for calibration and validation of the hyperspectral microscope system. The core protocol is adapted from a general protocol proposed for spectral i with modifications specific to the monochromator-based imaging approach. A validation step includes a comparison with a previously calibrated and validate imaging (HSI) system.

Processing of Hyperspectral Images
Hyperspectral images consist of two spatial dimensions and a spect This can be thought of as images containing a full spectrum in each pixel datasets are not intuitive for interpretation, appropriate methods must be interpretable information.
For visualization purposes, an RGB image can be obtained from a image by projecting the normalized transmittance spectra to CIE XYZ trist [29], summing over all the wavelengths and dividing by the number of w this way, a CIE XYZ color space representation was obtained. A MAT xyz2rgb was then used to convert to RGB color space appropriate for visua the option of the standard D65 illuminant. Protocol for calibration and validation of the hyperspectral microscope imaging (HMI) system. The core protocol is adapted from a general protocol proposed for spectral imaging systems with modifications specific to the monochromator-based imaging approach. Additionally, the validation step includes a comparison with a previously calibrated and validated hyperspectral imaging (HSI) system.

Processing of Hyperspectral Images
Hyperspectral images consist of two spatial dimensions and a spectral dimension. This can be thought of as images containing a full spectrum in each pixel. Because such datasets are not intuitive for interpretation, appropriate methods must be used to extract interpretable information.
After acquiring the hyperspectral image I acq. [x, y, λ], an unobstructed beam reference I re f [x, y, λ] must be recorded. In our system, this was achieved by removing the sample and acquiring another image. Additionally, a dark reference I dark [x, λ] must be acquired if the dark current is not negligible. In the case of our system, due to the exceptionally low dark current and electronic noise, this measurement was not necessary. A white-referencenormalized transmittance image that mitigates problems of illumination homogeneity and nonconstant spectrum of the light source is calculated by dividing the acquired intensity image by the white reference image as For visualization purposes, an RGB image can be obtained from a hyperspectral image by projecting the normalized transmittance spectra to CIE XYZ tristimulus spectra [29], summing over all the wavelengths and dividing by the number of wavelengths. In this way, a CIE XYZ color space representation was obtained. A MATLAB function xyz2rgb was then used to convert to RGB color space appropriate for visualization, using the option of the standard D65 illuminant.
Furthermore, concentrations of stains, and more generally, endogenous and exogenous chromophores, can be extracted from the spectral data. Because the tissue slices in this Sensors 2023, 23, 2374 6 of 18 study were thin, the contribution of light scattering was omitted, thus approximating the light-tissue interaction with a nonscattering form of the Beer-Lambert law [30] where T is the measured transmittance, I is the measured intensity, I 0 is the unobstructed beam reference, µ a (λ) is the absorption coefficient, and z is the sample thickness. The absorption coefficient was estimated by combining the contributions of absorption coefficients of hematoxylin and eosin µ a,hematoxylin and µ a,eosin with their volume fractions in the shape of µ a (λ) = c h µ a,hematoxylin (λ) + c e µ a,eosin (λ).
Absorption coefficients were obtained from the literature [31] and were reported in relative units. They are, thus, applicable only for the generation of relative concentration maps. Sample thickness z was measured by focusing on the top and the bottom surfaces of the slide and reading out the focusing stage positions.
With the light-tissue interaction model set up, the concentrations of both histological dyes were extracted from measured transmittance spectra using the least squares fitting method lsqnonlin in MATLAB, with concentrations c h and c e as the free parameters.

Spectral Calibration and Characterization
Multiple steps were needed to calibrate the system and test its performance. First, the wavelength scale was calibrated by monitoring the light emitted by the monochromator with a spectrometer, thus obtaining the reference central wavelength and spectral shape of the light. Light filtered by the monochromator was measured with an Ocean Optics USB2000+ UV-VIS spectrometer (Ocean Insight, Orlando, FL, USA) connected to the system instead of the ASEQ LR-1 used for online monitoring. The USB2000+ had a higher resolution than the LR-1 and was, thus, more appropriate for fine calibration of the system. Because only the relation of wavelength vs. monochromator absolute position in degrees and width of the spectrum was of interest, all measurements were normalized to 1, thus easing both visualization and processing. Although this step removes the information about the absolute intensity, it follows the image processing protocol standard to spectroscopy, where transmittance data is normalized to a reference intensity without a sample. A set of relative intensity spectra recorded in the range of −9 • to −35 • of the diffraction grating positions in steps of 1 • corresponding to the visible light is presented in Figure 3b.
Calibration of the absolute monochromator position (expressed in degrees) to the peak wavelength of light emitted was based on the grating formula [32], accounting for the first order of diffraction, as The grating constant d was specified by the manufacturer and set at 555.56 nm; the parameters α and β were angles of the incoming and diffracted light, respectively, and varied with the rotation stage position θ of the grating. Parameters α and β were computed by fitting the Equation (4) to the measured central wavelengths λ and corresponding stage positions θ. The definition of the parameters is given in Figure 3a. The results of the fit resulting in α = 38.6 ± 0.1 • and β = 9.46 ± 0.1 • are displayed in Figure 4a. Because the reliability of the calibration depends strongly on the precision of stage position reading, thorough testing of repeatability and reliability was performed later in this section as part of the characterization protocol.
1, thus easing both visualization and processing. Although this step removes information about the absolute intensity, it follows the image processing proto standard to spectroscopy, where transmittance data is normalized to a reference intens without a sample. A set of relative intensity spectra recorded in the range of −9° to −35° the diffraction grating positions in steps of 1° corresponding to the visible light presented in Figure 3b.  Calibration of the absolute monochromator position (expressed in degrees) to th peak wavelength of light emitted was based on the grating formula [32], accounting fo the first order of diffraction, as (4 The grating constant was specified by the manufacturer and set at 555.56 nm; th parameters and were angles of the incoming and diffracted light, respectively, and varied with the rotation stage position of the grating. Parameters and wer computed by fitting the Equation (4) to the measured central wavelengths and corresponding stage positions . The definition of the parameters is given in Figure 3a The results of the fit resulting in = 38.6 ± 0.1° and = 9.46 ± 0.1° are displayed in Figure 4a. Because the reliability of the calibration depends strongly on the precision o stage position reading, thorough testing of repeatability and reliability was performed later in this section as part of the characterization protocol. Besides the calibration of the central wavelength, the spectral resolution wa determined by evaluating the full width at half maximum (FWHM) of a given measured peak, shown in Figure 3b. The largest FWHM was around 400 nm (2.3 nm), which wa taken as the system's resolution; FWHM continually decreased with wavelength, reaching values of around 1.5 nm at the central wavelength of approximately 750 nm (Figure 3b) The observed FWHM trend is expected, considering the typical decrease of linea dispersion toward higher wavelengths [32].
Next, the repeatability of the stage positioning was evaluated. Two possible ways to determine the central wavelengths of the light emitted from the monochromator wer considered. First, a stage was sent to the required angle using Equation (4); this approach was simple but inaccurate because the precision of the stage was limited to 0.05°. A bette option was to send the grating into an approximate position and then calculate the centra wavelength from the included encoder that had an angular resolution of 0.0025°. Th Besides the calibration of the central wavelength, the spectral resolution was determined by evaluating the full width at half maximum (FWHM) of a given measured peak, shown in Figure 3b. The largest FWHM was around 400 nm (2.3 nm), which was taken as the system's resolution; FWHM continually decreased with wavelength, reaching values of around 1.5 nm at the central wavelength of approximately 750 nm (Figure 3b). The observed FWHM trend is expected, considering the typical decrease of linear dispersion toward higher wavelengths [32].
Next, the repeatability of the stage positioning was evaluated. Two possible ways to determine the central wavelengths of the light emitted from the monochromator were considered. First, a stage was sent to the required angle using Equation (4); this approach was simple but inaccurate because the precision of the stage was limited to 0.05 • . A better option was to send the grating into an approximate position and then calculate the central wavelength from the included encoder that had an angular resolution of 0.0025 • . The repeatability was tested by sending the stage to a set of wavelengths ten times, with homing initiated between measurements. After two repetitions for each measurement, the software was closed, and the stage disconnected from power to simulate different startups and evaluate encoder calibration effects. Values of the central wavelengths were recorded using the spectrometer and compared to the requested values as well as those calculated from the encoder positions. The results are presented in Figure 5.  These results show that due to the low positioning precision of the piezo resonan rotation stage, deviations between the true and the requested wavelengths were about nm. By using the integrated encoder, differences lower than 0.5 nm were observed. Thi was also close to the resolution of the UV-VIS USB2000+ spectrometer, which was abou 0.35 nm. Therefore, requested wavelengths were used only to label the slices in images while for the processing and further analysis tasks, the wavelengths were calculated from the recorded stage positions. The spectral precision of our system was thus 0.5 nm, limite by the encoder resolution repeatability, and the resolution of 2.5 nm, limited by th spectral bandpass of the device.

Spatial Calibration and Characterization
After the spectral calibration, the spatial scale for each objective lens was evaluate to establish the size of the detector pixel image on the object plane, enabling accurat measurements of distances on the recorded images. This pixel size calibration wa performed by acquiring images of the calibration stage micrometer R1L3S1P (Thorlabs Newton, NJ, USA). Distance in µm in the object plane was related to the size of th image on the detector in pixels by a simple relation = ∆ · , where ratio ∆ must b calculated for each objective lens separately. The image inspection tool imtool in MATLA was used to measure the distance in pixels on the image by using the length measuremen tool and measuring between the edges of the dark stripes. These measurements were the used to calculate ∆ based on the known distance between the lines. Spatial calibratio revealed that at magnifications starting with the 10× objective lens, the pixel size in th image plane was below the diffraction limit, and thus, binning of the pixels can b implemented without loss in terms of resolvable features. The results of the spatia calibration are presented in Table 1. These results show that due to the low positioning precision of the piezo resonant rotation stage, deviations between the true and the requested wavelengths were about 1 nm. By using the integrated encoder, differences lower than 0.5 nm were observed. This was also close to the resolution of the UV-VIS USB2000+ spectrometer, which was about 0.35 nm. Therefore, requested wavelengths were used only to label the slices in images, while for the processing and further analysis tasks, the wavelengths were calculated from the recorded stage positions. The spectral precision of our system was thus 0.5 nm, limited by the encoder resolution repeatability, and the resolution of 2.5 nm, limited by the spectral bandpass of the device.

Spatial Calibration and Characterization
After the spectral calibration, the spatial scale for each objective lens was evaluated to establish the size of the detector pixel image on the object plane, enabling accurate measurements of distances on the recorded images. This pixel size calibration was performed by acquiring images of the calibration stage micrometer R1L3S1P (Thorlabs, Newton, NJ, USA). Distance in µm in the object plane x was related to the size of the image on the detector n in pixels by a simple relation x = ∆x·n, where ratio ∆x must be calculated for each objective lens separately. The image inspection tool imtool in MATLAB was used to measure the distance in pixels on the image by using the length measurement tool and measuring between the edges of the dark stripes. These measurements were then used to calculate ∆x based on the known distance between the lines. Spatial calibration revealed that at magnifications starting with the 10× objective lens, the pixel size in the image plane was below the diffraction limit, and thus, binning of the pixels can be implemented without loss in terms of resolvable features. The results of the spatial calibration are presented in Table 1. Actual resolving power was also evaluated by the USAF1951 pattern R3L1S4P (Thorlabs, Newton, NJ, USA). The resolving power for the 5× objective lens was 181 linepairs/mm, while the resolving power for other objective lenses was greater than 228 linepairs/mm, which was the highest power available on the test target. Resolution for the 5× objective lens was, thus, (2.8 ± 0.4) µm, with the uncertainty given by the element resolution step of the USAF target. For the remaining lenses, the resolving power was estimated as the width of the edge in the USAF target and was (2 ± 0.1) µm for the 10× lens, (1.7 ± 0.1) µm for the 20× lens, and (1.3 ± 0.1) µm for both the 50× and the 100× lenses. Because the actual resolution in terms of lowest resolvable features was given by the quality of optical components and the wavelength of the light used for the imaging, the highest achievable resolution was determined to be 1.3 µm, and no increase in resolution was observed when using the 100× lens instead of the 50× one. Due to the trade-off between the resolution and FOV size, the 10× objective lens provides optimal resolution while still possessing a comparatively large FOV.

Validation
The system was validated by imaging a set of liquid dye samples sandwiched between two microscopy glasses. Samples were measured using a reference PerkinElmer Lambda 1050 UV/VIS/NIR (PerkinElmer, Waltham, MA, USA) laboratory spectrometer that served as the gold standard as well as our custom-made hyperspectral imaging (HSI) system [26,33].
The sample cells were prepared in a standard fashion for the microscopy of liquid samples as used in microrheology and microfluidics [34]. Briefly, the liquid diluted ink sample was placed by means of capillary action between a cleaned object and cover slides and sealed by means of a UV-cured optical adhesive (NOA63, Norland Products, Jamesburg, NJ, USA) to create a channel for the ink. The thickness of the sample cells, as measured by the microscope, was approximately 100 µm with deviations across the sample cells of about 20%. In the resulting cell samples, the amount of the pigment varied across the sample due to two factors: (i) variation in the cell thickness and (ii) separation of the pigment in ink from the solvent.
For the reference measurement of sample cells, the reference laboratory spectrometer with a 3D WB detector module was used. For validation, blue and red ink were employed because their respective spectra were not overlapping. Spectra were measured in the collimated transmittance mode and normalized to an unobstructed beam.
The ink cells were imaged using our custom-made HMI system. Spectra were normalized, and an averaged normalized spectrum from the central part of the sample was used for comparison. First, the raw normalized spectra were compared for both the HMI system and reference spectrometer ( Figure 6). As the agreement of absolute spectra was expected to be inadequate, normalized absorbances were calculated by taking the logarithm of the transmittance value T and normalizing it to the maximal value, where a was the normalization factor considering that different modalities collected different amounts of light. Values of the normalization factors a were 1.17 for red ink and 1.03 for blue ink. Figure 6 shows an excellent agreement between the reference and the HMI systems when considering normalized absorbance.
Sensors 2023, 23, x FOR PEER REVIEW 10 of 18 Figure 6. Comparison between spectra measured by HMI and reference spectra. (a) Comparison of raw normalized spectra acquired using the reference spectrometer and custom-made HMI system. (b) Normalized absorbance from reference and HMI measured spectra.
In addition, we compared the HMI spectra with those obtained by the custom-made HSI system for macroscopic samples [26,33]. Comparison between both modalities, shown in Figure 7, reveals that normalized raw spectra exhibit similar shapes, while normalized absorbance values demonstrate almost perfect agreement. An additional indicator of an excellent agreement between both modalities is the same normalization factor a = 1.05, obtained for red as well as blue ink.

HMI of a Tissue Sample
To demonstrate the use of the HMI system, we imaged a standard hematoxylin and eosin-stained histological sample of the murine abdominal wall [35,36]. The raw spectral data were first normalized by an unobstructed light field, thus normalizing the values to transmittance as well as eliminating illumination field inhomogeneity. Figure 8a shows an RGB projection of a hyperspectral cube obtained using the methods described in Section 2.3. This image is analogous to a classical RGB histology image; in fact, it appears closely similar to a standard histology image before background removal and contrast enhancement in postprocessing. Figure 8b shows spectra selected from the image shown in Figure 8a at three different points on the sample itself and at one point on a section Figure 6. Comparison between spectra measured by HMI and reference spectra. (a) Comparison of raw normalized spectra acquired using the reference spectrometer and custom-made HMI system. (b) Normalized absorbance from reference and HMI measured spectra.
In addition, we compared the HMI spectra with those obtained by the custom-made HSI system for macroscopic samples [26,33]. Comparison between both modalities, shown in Figure 7, reveals that normalized raw spectra exhibit similar shapes, while normalized absorbance values demonstrate almost perfect agreement. An additional indicator of an excellent agreement between both modalities is the same normalization factor a = 1.05, obtained for red as well as blue ink.
Sensors 2023, 23, x FOR PEER REVIEW 10 of 18 Figure 6. Comparison between spectra measured by HMI and reference spectra. (a) Comparison of raw normalized spectra acquired using the reference spectrometer and custom-made HMI system. (b) Normalized absorbance from reference and HMI measured spectra.
In addition, we compared the HMI spectra with those obtained by the custom-made HSI system for macroscopic samples [26,33]. Comparison between both modalities, shown in Figure 7, reveals that normalized raw spectra exhibit similar shapes, while normalized absorbance values demonstrate almost perfect agreement. An additional indicator of an excellent agreement between both modalities is the same normalization factor a = 1.05, obtained for red as well as blue ink.

HMI of a Tissue Sample
To demonstrate the use of the HMI system, we imaged a standard hematoxylin and eosin-stained histological sample of the murine abdominal wall [35,36]. The raw spectral data were first normalized by an unobstructed light field, thus normalizing the values to transmittance as well as eliminating illumination field inhomogeneity. Figure 8a shows an RGB projection of a hyperspectral cube obtained using the methods described in Section 2.3. This image is analogous to a classical RGB histology image; in fact, it appears closely similar to a standard histology image before background removal and contrast enhancement in postprocessing. Figure 8b shows spectra selected from the image shown in Figure 8a at three different points on the sample itself and at one point on a section

HMI of a Tissue Sample
To demonstrate the use of the HMI system, we imaged a standard hematoxylin and eosin-stained histological sample of the murine abdominal wall [35,36]. The raw spectral data were first normalized by an unobstructed light field, thus normalizing the values to transmittance as well as eliminating illumination field inhomogeneity. Figure 8a shows an RGB projection of a hyperspectral cube obtained using the methods described in Section 2.3. This image is analogous to a classical RGB histology image; in fact, it appears closely similar to a standard histology image before background removal and contrast enhancement in postprocessing. Figure 8b shows spectra selected from the image shown in Figure 8a at three different points on the sample itself and at one point on a section containing only glass without tissues. The point labeled 2 is selected from a section of the sample subsided by cell nuclei. The nuclei are stained strongly by the hematoxylin dye that is blue-black in appearance. The spectrum at this point reveals a high absorption and, hence, lower transmittance throughout the visible part of the spectrum. Points annotated 1 and 3 are in the cell cytosol and are thus primarily stained by eosin. Eosin is a dye that is purple-red in color. Consequently, a large absorption in the green part of the spectrum, roughly between 500 nm and 550 nm, is present.
A marked difference between the intensity of color at points 2 and 3 is visible in the RGB projection (Figure 8a). This difference is even easier to discern in the transmittance spectra as a decrease in the fraction of the transmitted light resulting from the increased absorption due to different concentrations of the stain. The point denoted 4 corresponds to a part of the slide where no sample is present. At this point, the transmission spectrum does not contain any significant features. The small oscillations attributed to interference between optical surfaces are due to the presence of the object slide, embedding resin, and cover slip.
Following the qualitative observations, a more quantitative approach was applied to the images to extract hematoxylin and eosin maps, as described in Section 2.3. Using this approach, it was possible to construct false color relative stain concentration maps shown in Figure 8c,d. The applicability of such stain concentration maps for further The point labeled 2 is selected from a section of the sample subsided by cell nuclei. The nuclei are stained strongly by the hematoxylin dye that is blue-black in appearance. The spectrum at this point reveals a high absorption and, hence, lower transmittance throughout the visible part of the spectrum. Points annotated 1 and 3 are in the cell cytosol and are thus primarily stained by eosin. Eosin is a dye that is purple-red in color. Consequently, a large absorption in the green part of the spectrum, roughly between 500 nm and 550 nm, is present.
A marked difference between the intensity of color at points 2 and 3 is visible in the RGB projection (Figure 8a). This difference is even easier to discern in the transmittance spectra as a decrease in the fraction of the transmitted light resulting from the increased absorption due to different concentrations of the stain. The point denoted 4 corresponds to a part of the slide where no sample is present. At this point, the transmission spectrum does not contain any significant features. The small oscillations attributed to interference between optical surfaces are due to the presence of the object slide, embedding resin, and cover slip.
Following the qualitative observations, a more quantitative approach was applied to the images to extract hematoxylin and eosin maps, as described in Section 2.3. Using this approach, it was possible to construct false color relative stain concentration maps shown in Figure 8c,d. The applicability of such stain concentration maps for further processing is vast. Possible applications that exploit the wealth of information contained therein include, among others, analysis of the chemical environment influencing the binding affinity of stains as well as image analysis algorithms for digital histology on separate nuclear and cellular images.

Discussion
The calibration and validation protocols can be, with different rigor, generalized to other existing HMI systems. Spatial calibration should be, in general, similar for all systems, be it a point-scanned whiskbroom or a rapid, albeit spectrally limited, snapshot imager. It is important to note that, regardless of the methodology used, calibration of the spectral resolution and step size must be performed. In a case such as the one presented in this paper, where excitation scanning is used, the proposed spectrometer measurements should be sufficient. However, when using an emission-scanning filtered methodology of acquisition, a previously calibrated and verified source of monochromatic light needs to be used to evaluate the resolution, spectral broadening, and spectral step.
The validation results for the liquid ink samples were compared with both the reference laboratory spectrometer as well as with our custom-developed laboratory hyperspectral imaging (HSI) system for macroscopic samples. Such two-fold validation has many advantages. First, it demonstrates the reliability of the system and, thus, sets the foundation to perform quantitative imaging. Second, the cross-validation with the HSI system enables analysis and comparison of spectral imaging data on two dramatically different length scales and could, thus, provide a channel to establish a better connection between the effects of microscopic tissue changes on macroscopically observed optical properties in the future. Carefully evaluating the system performance and determining its repeatability in terms of central wavelength and proper determination of spectral resolution is of key import. If a system is characterized in such a way, the results are consistent, and the repeatability of experiments conducted using such a device is ensured.
As an illustration of the possible use of the developed system, we presented a hyperspectral image of a histology slide. The spectral information contained within the image is successfully used to decouple the contributions of hematoxylin and eosin stains. Although the results presented are preliminary and, as such, not clinically significant, the potential to study the staining of histology samples quantitatively is promising and could prove a useful tool in the future development of quantitative histology.
The great power of hyperspectral imaging lies in its ability to discern small changes in different chromophore concentrations that reflect the changes in the surrounding tissue.
Using the system presented in this paper, two different approaches can be envisioned to evaluate these changes. First, tissue-native chromophores, such as hemoglobin, collagen, and cytochromes, could be evaluated through their specific absorption spectra. This approach would, however, require unstained tissue samples and in-depth knowledge of the effects tissue fixation and embedding have on their optical properties. Alternatively, the chemical environment of the tissue also affects the staining process. Thus, observation of small changes in histology stain concentration could reveal processes in the tissue that would otherwise remain unnoticed.
In this paper, we have shown a decomposition of an H&E histology slide into individual hematoxylin and eosin maps using hyperspectral methods. Such a deconvolution into individual stain images is a common step in quantitative histology evaluation [37]. It can be achieved by approaches generally termed color deconvolution that includes the calculation of stain-specific weighted averages of RGB channels in a normal color im-age [37]. More advanced methods could also be used, such as color phasors [38]. Due to the limited information contained in a normal RGB image, only a handful of different stains can be evaluated, and analysis depends on the quality of the illumination. In hyperspectral imaging, information about sample staining is contained in hundreds of different channels, thoroughly describing the sample absorbance. This, in turn, enables spectroscopic analysis that can identify different stains even when their absorption spectra are similar or overlapping.
A great advantage of our system is the modularity that is inherent to its design. The modularity and versatility of the presented system may help in the development of new imaging protocols for specialized samples where existing commercial systems offer insufficient adaptability.

Conclusions
In this paper, we have shown the calibration, characterization, and validation of a custom-based HMI system for biomedical applications. To the best of our knowledge, this is the first HMI system that was cross verified with an HSI system for macroscopic samples. This validation step enables imaging of the same samples at dramatically different magnifications, making possible the quantitative comparison of optical as well as morphological properties on different scales. To demonstrate the system performance, a histology slide stained with hematoxylin and eosin was imaged, and hyperspectral image processing methods were used to first represent it in an RGB projection as well as to construct relative stain concentration maps.
The primary objective of the study, the validation of the system following protocols, was achieved through the implementation of the modified calibration and validation protocol. Such protocols are instrumental in the standardization of HMI systems and a necessary steppingstone in establishing HMI as a diagnostic tool.
The standardization of HMI systems is of utmost importance in order to advance this new imaging modality and to meet future diagnostic challenges. HMI in biomedicine is still in its infancy, and our work is an attempt to improve technical standards while keeping in mind engineers, physicists, and clinicians alike.

Data Availability Statement:
The data that support the findings of this study are available upon reasonable request from the authors. Figure A1. Relative intensity of the monochromator light source as detected by the camera. The intensity was normalized to the maximum value to aid with visualization. Please note that the intensity recorded by the camera is a product of the halogen light source spectrum, transmittances of all the optical components in the light path, and sensitivity of the detector.

Appendix B
Because the system is completely modular and could be easily modified, the control software should fulfill the following requirements: 1. Software should be modular and available for source code customization. 2. Software should support (I) a plug-in-based architecture for different microscopy modules as well as (II) a simple yet general programming interface for the addition of new modules. 3. Software should support as many of the integrated components as possible out of the box without custom-made drivers. 4. Since the acquisition of larger samples will be implemented in the future, software should support the scripted acquisition and whole slide scanning.  Figure A1. Relative intensity of the monochromator light source as detected by the camera. The intensity was normalized to the maximum value to aid with visualization. Please note that the intensity recorded by the camera is a product of the halogen light source spectrum, transmittances of all the optical components in the light path, and sensitivity of the detector.

Appendix B
Because the system is completely modular and could be easily modified, the control software should fulfill the following requirements: 1.
Software should be modular and available for source code customization.

2.
Software should support (I) a plug-in-based architecture for different microscopy modules as well as (II) a simple yet general programming interface for the addition of new modules.

3.
Software should support as many of the integrated components as possible out of the box without custom-made drivers.

4.
Since the acquisition of larger samples will be implemented in the future, software should support the scripted acquisition and whole slide scanning.
A popular software in the field of microscopy that is often used to control both general production and custom microscopes is an advanced modular microscopy control framework Micro-Manager [41], built atop the image processing toolbox ImageJ [42,43], which already supports the Zyla 5.5 camera used in our system. It offers its own scripting language for automated acquisition and a series of plugins that allow for whole slide scanning. Additionally, it supports generalized component types, which can be used to integrate any component not supported out-of-the-box in the software through an intermediate interface. As it is built on top of ImageJ, it already supports many different image formats and image analysis tools, and due to this modularity and high customizability, it is the optimal framework that fulfills the requirements above. The design of the software and its subsequent integration into the Micro-Manager and ImageJ environment consists roughly of two parts (device adapters implementing hardware functions written in C programming language and plugins that control the system written in Java programming language), as depicted schematically in the diagram of the software implementation ( Figure A2). A popular software in the field of microscopy that is often used to control both general production and custom microscopes is an advanced modular microscopy control framework Micro-Manager [41], built atop the image processing toolbox ImageJ [42,43], which already supports the Zyla 5.5 camera used in our system. It offers its own scripting language for automated acquisition and a series of plugins that allow for whole slide scanning. Additionally, it supports generalized component types, which can be used to integrate any component not supported out-of-the-box in the software through an intermediate interface. As it is built on top of ImageJ, it already supports many different image formats and image analysis tools, and due to this modularity and high customizability, it is the optimal framework that fulfills the requirements above. The design of the software and its subsequent integration into the Micro-Manager and ImageJ environment consists roughly of two parts (device adapters implementing hardware functions written in C programming language and plugins that control the system written in Java programming language), as depicted schematically in the diagram of the software implementation ( Figure A2). Figure A2. The software architecture of the control system. The main framework is ImageJ, which runs either a custom HSI viewer plugin written in Java or the Micro-Manager (MM) environment. To communicate with Micro-Manager API, each device has a C class that implements the Micro-Manager device adapter interface, communicating with Micro-Manager on one side and the device on the other. For acquisition control, a separate plugin written in Java implementing Micro-Manager plugin architecture is used. This plugin can access all the devices in the configured system via the general Micro-Manager API.